package com.komon.factory;

import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;

import com.komon.object.response.HttpResponse;
import com.komon.object.response.StatusLine;
import com.komon.util.CommonUtils;

public class ResponseFactory {
	
	public static HttpResponse creatResponseByStatus(int statusCode, OutputStream socketOutputStream) throws UnsupportedEncodingException{
		StatusLine statusLine = new StatusLine(statusCode);
		Map<String, String> headers = generateDefaultHeader();
		return new HttpResponse(statusLine, headers, socketOutputStream);
	}
	
	//TODO
	private static Map<String, String> generateDefaultHeader() {
		Map<String, String> headers = new HashMap<String, String>();
		headers.put("Date", CommonUtils.getRFCDataString());
		
		return headers;
	}
	
}
